﻿<BadHabit_WPFTools:ShapedWindow
    x:Class="BadHabit.Factory.Views.EditFixedCosts"
    x:Name="window"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Factory_Core="clr-namespace:BadHabit.Factory;assembly=BadHabit.FactoryCore"    
    xmlns:BadHabit_WPFTools="clr-namespace:BadHabit.WPFTools;assembly=BadHabit.WPFTools"        
    xmlns:BadHabit_WPFTools_Converters="clr-namespace:BadHabit.WPFTools.Converters;assembly=BadHabit.WPFTools"
    xmlns:Microsoft_Toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
    xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
    
    xmlns:props="clr-namespace:BadHabit.Factory.Windows.Properties"
    
    Topmost="True"
    
    WindowStartupLocation="CenterScreen"
    
    Loaded="window_Loaded"
    
    Title="{x:Static props:Resources.Project_Fixed_Costs}"
    Style="{StaticResource DialogEditWindow}"
    
    Width="600"    
    SizeToContent="Height"
    MaxHeight="600"
    >

    <BadHabit_WPFTools:ShapedWindow.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Undo" Executed="Undo_Executed"/>
        <CommandBinding Command="ApplicationCommands.Save" Executed="Save_Executed"/>
    </BadHabit_WPFTools:ShapedWindow.CommandBindings>

    <Border Style="{StaticResource RoundBorder}" Margin="4">

        <BadHabit_WPFTools:DataGrid
                x:Name="fixedCostsDataGrid"            
                ItemsSource="{Binding ProposalFixedCostItem}"                                                
                AutoGenerateColumns="False"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch"
                
            UseNavigationExtensions="True"
            
                GridLinesVisibility="All"
            
                InitializingNewItem="fixedCostsDataGrid_InitializingNewItem"
                     
                CanUserDeleteRows="True"
                CanUserAddRows="True"
                CanUserSortColumns="True"
                
                        
                ScrollViewer.VerticalScrollBarVisibility="Auto"
                ScrollViewer.HorizontalScrollBarVisibility="Disabled">


            <Microsoft_Toolkit:DataGrid.Columns>
                
                <Microsoft_Toolkit:DataGridTemplateColumn
                    CanUserResize="False"
                    Header="{x:Static props:Resources.Payable}"
                    CellStyle="{StaticResource CenterAlignCellStyle}"                                        
                    Width="Auto">
                    <Microsoft_Toolkit:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Payable}"/>
                        </DataTemplate>
                    </Microsoft_Toolkit:DataGridTemplateColumn.CellTemplate>
                </Microsoft_Toolkit:DataGridTemplateColumn>
              


                <Microsoft_Toolkit:DataGridTextColumn                               
                        Width="*"
                        Header="{x:Static props:Resources.Cost_Description}"
                        CanUserResize="True"                        
                        Binding="{Binding ItemName}">
                    <Microsoft_Toolkit:DataGridTextColumn.EditingElementStyle>
                        <Style TargetType="TextBox" BasedOn="{StaticResource TransparentEditingElementStyle}">
                            <Setter Property="MaxLength" Value="150"/>
                        </Style>
                    </Microsoft_Toolkit:DataGridTextColumn.EditingElementStyle>
                </Microsoft_Toolkit:DataGridTextColumn>

                <Microsoft_Toolkit:DataGridTextColumn
                        Header="{x:Static props:Resources.Cost_Value}"                        
                        CanUserResize="True"
                        Width="100"                        
                        CellStyle="{StaticResource RightAlignCellStyle}"                        
                        SortDirection=""
                        Binding="{Binding ItemValue, StringFormat='{}{0:C}'}"/>

            </Microsoft_Toolkit:DataGrid.Columns>

        </BadHabit_WPFTools:DataGrid>


    </Border>


</BadHabit_WPFTools:ShapedWindow>